<template>
  <div class="common-wrap">
    <div class="entrust">
      <MyForm
        v-model:formData="formData"
        v-model:columns="formColumns"
        :rules="rules"
        :porpModel="true"
        labelWidth="120"
        :saveBtnLoading="saveBtnLoading"
        @submit="onSubmit"
      >
      </MyForm>
    </div>
    <PickupAddress
      v-if="pickupAddressVisible"
      v-model:visible="pickupAddressVisible"
      @onSubmit="onPickupAddress"
    ></PickupAddress>
  </div>
</template>

<script setup>
import { ref, onMounted, watch } from "vue";
import i18n from "@/lang/index.js";
import * as api from "@/api/index.js";
import { getSubZhEn, columnFilters,characterSegmentation } from "@/utils/mUtils.js";
import { useRoute } from "vue-router";
import { ElMessage } from "element-plus";
import PickupAddress from "./pickupAddress.vue";
const router = useRoute();
const formData = ref({
  pickupAddressList: [],
});
const formColumns = ref([
  {
    title: "委托",
    structure: [
      {
        title: "基础信息",
        formLayout: "el-row-column",
        content: [
          {
            content: [
              {
                label: "客户名称",
                prop: "customerCode",
                type: "remote_select",
                placeholder: "请选择委托单位",
                params: {
                  searchKey: "keyword",
                  keyValue: "customerCode",
                  name: "customerNameZh",
                  abbreviation: "customerCode",
                  showCustomizedOption: true,
                  displayKey: {
                    coopTypeStr: "coopTypeStr",
                    customerAbbr: "customerAbbr",
                  },
                  fixedParams: {
                    coopType: "0",
                  },
                },
                paramsKey: {
                  customerNameZh: "customerNameZh",
                  customerServiceCode: "",
                  customerServiceName: "",
                  bindEmployeeList: "",
                  shipperInfo: "",
                  consigneeInfo: "",
                  notifierInfo: "",
                  noPrefix: "",
                },
                apiModule: api.default.common.customers.selectAllCoopList,
                handleRemoteChange: (val, data, c) => {
                  if (!val) return;
                  customerGetInfo(data.customerCode);
                },
              },
              {
                label: "FBA Shipment ID",
                prop: "fbaShipmentId",
                type: "label_input",
                inputType: "textarea",
              },
              {
                label: "原单号",
                prop: "originNo",
                type: "label_input",
                inputType: "textarea",
              },
            ],
          },
          {
            content: [
              {
                label: "前缀",
                prop: "noPrefix",
                type: "label_select",
                options: [],
                props: {
                  label: "label",
                  value: "value",
                },
              },
              {
                label: "Reference ID",
                prop: "referenceId",
                type: "label_input",
                inputType: "textarea",
              },
              {
                label: "参考单号",
                prop: "referenceNo",
                type: "label_input",
                inputType: "textarea",
              },
            ],
          },
          {
            content: [
              {
                label: "客服",
                prop: "customerServiceName",
              },
              {
                label: "客户入仓号",
                prop: "customerInStorageNo",
                type: "label_input",
                inputType: "textarea",
              },
              {
                label: "转单号",
                prop: "transferNo",
                type: "label_input",
                inputType: "textarea",
              },
            ],
          },
          {
            content: [
              {
                label: "业务员",
                prop: "bindEmployeeList",
                listKey: "empName",
                joinStr: ",",
              },
              {
                label: "关联单号",
                prop: "relatedNo",
                type: "label_input",
                inputType: "textarea",
              },
              {
                label: "询价号",
                prop: "inquiryNo",
                type: "label_input",
              },
              {
                label: "转单运输商",
                prop: "transferCarrierCode",
                name: "transferCarrierName",
                type: "remote_select",
                placeholder: "请选择订舱代理",
                params: {
                  searchKey: "keyword",
                  keyValue: "customerCode",
                  name: "customerNameZh",
                  abbreviation: "customerCode",
                  showCustomizedOption: true,
                  displayKey: {
                    coopTypeStr: "coopTypeStr",
                    customerAbbr: "customerAbbr",
                  },
                  fixedParams: {
                    coopType: "1",
                  },
                },
                paramsKey: {
                  transferCarrierName: "customerNameZh",
                },
                apiModule: api.default.common.customers.selectAllCoopList,
              },
            ],
          },
        ],
      },
      {
        title: "订单信息",
        formLayout: "el-row-column",
        content: [
          {
            content: [
              {
                label: "订单类型",
                prop: "orderTypeCode",
                name: "orderTypeName",
                options: [],
                props: {
                  value: "subCode",
                  label: "subName",
                },
                type: "label_select",
              },
              {
                label: "渠道名称",
                prop: "subProductId",
                name: "subProductName",
                type: "remote_select",
                params: {
                  searchKey: "searchKey",
                  keyValue: "id",
                  name: "subProductName",
                  abbreviation: "lineCode",
                  showCustomizedOption: true,
                  queryId: true,
                  displayKey: {
                    mainProductName: "mainProductName",
                    lineDetailDesc: "lineDetailDesc",
                  },
                },
                paramsKey: {
                  subProductName: "subProductName",
                  deliveryMethodName: "deliveryMethodName",
                  deliveryMethodCode: "deliveryMethodCode",
                  calcWeightRuleId: "calcWeightRuleId",
                  calcWeightRuleName: "calcWeightRuleName",
                  overSizeRuleId: "overSizeRuleId",
                  includeTaxFlag: "includeTaxFlag",
                  chargeMethodCode: "chargeMethodCode",
                  chargeMethodName: "chargeMethodName",
                },
                apiModule: api.default.common.product.queryList,
                handleRemoteChange: (val, data, c) => {
                  if (!val) return;
                  goodsTypeArr(data);
                },
              },
              {
                label: "运输方式",
                prop: "deliveryMethodName",
              },
            ],
          },
          {
            content: [
              {
                label: "计重规则",
                prop: "calcWeightRuleName",
              },
              {
                label: "超规规则",
                prop: "overSizeRuleName",
              },
              {
                label: "是否包税",
                labelKey: {
                  1: "是",
                  0: "否",
                  2: "其他",
                },
                options: [
                  {
                    value: "includeTaxFlag",
                  },
                ],
              },
            ],
          },
          {
            content: [
              {
                label: "报关类型",
                prop: "customsDeclareTypeCode",
                name: "customsDeclareTypeName",
                options: [],
                props: {
                  value: "subCode",
                  label: "subName",
                },
                type: "label_select",
              },
              {
                label: "清关方式",
                prop: "customsClearanceTypeCode",
                name: "customsClearanceTypeName",
                options: [],
                props: {
                  value: "subCode",
                  label: "subName",
                },
                type: "label_select",
              },
            ],
          },
          {
            content: [
              {
                label: "发货人",
                prop: "shipperInfo",
                type: "label_input_textarea_autocomplete",
                options: [],
                labelKey: {
                  customerCode: "customerCode",
                  customerNameZh: "customerNameZh",
                  countryName: "countryName",
                  provinceName: "provinceName",
                  cityName: "cityName",
                  areaName: "areaName",
                },
              },
              {
                label: "收货人",
                prop: "consigneeInfo",
                type: "label_input_textarea_autocomplete",
                options: [],
                labelKey: {
                  customerCode: "customerCode",
                  customerNameZh: "customerNameZh",
                  countryName: "countryName",
                  provinceName: "provinceName",
                  cityName: "cityName",
                  areaName: "areaName",
                },
              },
              {
                label: "通知人",
                prop: "notifierInfo",
                type: "label_input_textarea_autocomplete",
                options: [],
                labelKey: {
                  customerCode: "customerCode",
                  customerNameZh: "customerNameZh",
                  countryName: "countryName",
                  provinceName: "provinceName",
                  cityName: "cityName",
                  areaName: "areaName",
                },
              },
            ],
          },
        ],
      },
      {
        title: "货物信息",
        formLayout: "el-row-column",
        content: [
          {
            content: [
              {
                label: "货物类型",
                prop: "goodsTypeCode",
                name: "goodsTypeName",
                type: "label_select",
                options: [],
                props: {
                  value: "subCode",
                  label: "subName",
                },
              },
              {
                label: "货物名称",
                prop: "goodsName",
                type: "label_input",
              },
              {
                label: "最终目的",
                prop: "destWarehouseCode",
                name: "destWarehouseName",
                detailedProp: "destWarehouseTypeName",
                detailedDisabled: true,
                type: "remote_select_input",
                params: {
                  searchKey: "searchKey",
                  keyValue: "warehouseCode",
                  name: "warehouseName",
                  abbreviation: "postcode",
                  showCustomizedOption: true,

                  displayKey: {
                    countryName: "countryName",
                    provinceName: "provinceName",
                    cityName: "cityName",
                    areaName: "areaName",
                    address: "address",
                  },
                },
                paramsKey: {
                  destWarehouseName: "warehouseName",
                  destWarehouseTypeCode: "typeCode",
                  destWarehouseTypeName: "typeName",
                  destWarehousePostCode: "postcode",
                  destWarehouseCountryName: "countryName",
                  destWarehouseCountryCode: "countryCode",
                  destWarehouseProvinceName: "provinceName",
                  destWarehouseProvinceCode: "provinceCode",
                  destWarehouseCityCode: "cityCode",
                  destWarehouseCityName: "cityName",
                  destWarehouseAreaName: "areaName",
                  destWarehouseAreaCode: "areaCode",
                  destWarehouseAddress: "address",
                },
                apiModule: api.default.common.warehouse.queryList,
                handleRemoteChange: (val, data, c) => {
                  if (!val) return;
                  formData.value.provinceCityArea = [
                    data.provinceCode,
                    data.cityCode,
                    data.areaCode,
                  ];
                },
              },
              {
                label: "国家/省/市/区",
                propSelectCode: "destWarehouseCountryCode",
                propSelectName: "destWarehouseCountryName",
                propSelectAdd: "countryAdd",
                prop: "provinceCityArea",
                detailedDisabled: true,
                detailedProp: "destWarehousePostCode",
                type: "label_province_city_area",
                propSelectOptions: [],
                propSelectPlaceholder: "国家",
                labelKey: {
                  destWarehouseCountryName: "destWarehouseCountryName",
                  destWarehouseProvinceName: "destWarehouseProvinceName",
                  destWarehouseCityName: "destWarehouseCityName",
                  destWarehouseAreaName: "destWarehouseAreaName",
                },
                parmasKey: {
                  provinceName: "destWarehouseProvinceName",
                  provinceCode: "destWarehouseProvinceCode",
                  cityName: "destWarehouseCityName",
                  cityCode: "destWarehouseCityCode",
                  areaName: "destWarehouseAreaName",
                  areaCode: "destWarehouseAreaCode",
                },
                propsSelect: {
                  value: "countryCode",
                  label: "countryName",
                  keyAdd: "countryAdd",
                },
                options: [],
                props: {
                  value: "areaCode",
                  label: "areaName",
                  children: "children",
                },
                placeholder: "省/市/区(县)",
                onCascaderChange: (argeObj) => {
                  formData.value = { ...formData.value, ...argeObj };
                },
              },
              {
                label: "",
                prop: "destWarehouseAddress",
                type: "label_input",
                inputType: "textarea",
              },
            ],
          },
          {
            content: [
              {
                label: "贴标",
                prop: "labelingTypeCode",
                name: "labelingTypeName",
                type: "label_select",
                collapseTags: true,
                multiple: true,
                options: [],
                props: {
                  value: "subCode",
                  label: "subName",
                },
              },
              {
                label: "备注",
                prop: "remark",
                type: "label_input",
                inputType: "textarea",
              },
              {
                label: "收货方式",
                prop: "receiveGoodsType",
                type: "label_radio",
                options: [
                  {
                    label: "客户自送",
                    value: 0,
                  },
                  {
                    label: "上门提货",
                    value: 1,
                  },
                ],
              },
              {
                label: "提货时间",
                prop: "pickUpTime",
                type: "label_date",
              },
              {
                label: "收货仓库",
                prop: "receiveWarehouseCode",
                detailedDisabled: true,
                type: "remote_select",
                params: {
                  searchKey: "searchKey",
                  keyValue: "warehouseCode",
                  name: "warehouseName",
                  abbreviation: "postcode",
                  showCustomizedOption: true,
                  displayKey: {
                    countryName: "countryName",
                    provinceName: "provinceName",
                    cityName: "cityName",
                    areaName: "areaName",
                    address: "address",
                  },
                  fixedParams: {
                    typeCode: "011001",
                  },
                },
                paramsKey: {
                  receiveWarehouseName: "warehouseName",
                },
                apiModule: api.default.common.warehouse.queryList,
              },
            ],
          },
          {
            span: 12,
            content: [
              {
                label: "预报",
                type: "label_multiple_number",
                options: [
                  {
                    prop: "forecastPcs",
                    unit: "件/板",
                    precision: 2,
                  },
                  {
                    prop: "forecastWeight",
                    unit: "KGS",
                    precision: 2,
                  },
                  {
                    prop: "forecastVolume",
                    unit: "CBM",
                    precision: 2,
                  },
                  {
                    prop: "forecastBoxNumber",
                    unit: "箱",
                    precision: 2,
                  },
                ],
              },
              {
                label: "入仓",
                options: [
                  {
                    value: "inStoragePcs",
                    unit: "件/板",
                  },
                  {
                    value: "inStorageWeight",
                    unit: "KGS",
                  },
                  {
                    value: "inStorageVolume",
                    unit: "CBM",
                  },
                ],
              },
              {
                label: "计费重",
                options: [
                  {
                    value: "chargeWeight",
                  },
                  {
                    value: "chargeMethodName",
                  },
                ],
              },
              {
                label: "结算数量",
                prop: "settlementWeight",
                precision: 3,
                type: "label_number",
                span: 12,
              },
              {
                label: "SO号",
                prop: "soNo",
                type: "label_input",
                span: 12,
              },
              {
                label: "MBL No",
                prop: "mblNo",
                type: "label_input",
                span: 12,
              },
              {
                label: "记账日期",
                prop: "accountingDate",
                type: "label_date",
                format: "YYYY-MM-DD",
                valueFormat: "YYYY-MM-DD",
                dateType: "date",
                span: 12,
              },
            ],
          },
        ],
      },
      {
        title: "提货地址",
        type: "tabel",
        prop: "pickupAddressList",
        tableIndex: 0,
        height: 200,
        columns: [
          {
            type: "checkbox",
            width: 50,
            fixed: "left",
            align: "center",
          },
          {
            field: "address",
            title: "提货地址",
            editRender: {},
            slots: { edit: "input_autocomplete" },
            params: {
              queryKey: "businessAddress",
              apiModule: api.default.common.customers.selectAllList,
              labelKey: {
                businessAddress: "address",
                countryName: "countryName",
                provinceName: "provinceName",
                cityName: "cityName",
                areaName: "areaName",
              },
              paramsKey: {
                address: "businessAddress",
                countryName: "countryName",
                countryCode: "countryCode",
                provinceName: "provinceName",
                provinceCode: "provinceCode",
                cityName: "cityName",
                cityCode: "cityCode",
                areaName: "areaName",
                areaCode: "areaCode",
                contactName: "contactName",
                contactPhone: "contactPhone",
              },
              onSelect: (val, c, row) => {
                row.provinceCityArea = [
                  val.provinceCode,
                  val.cityCode,
                  val.areaCode,
                ];
              },
            },
          },
          {
            title: "国家/省/市/区",
            field: "countryCode",
            params: {
              propSelectName: "countryName",
              propSelectAdd: "countryAdd",
              prop: "provinceCityArea",
              propSelectPlaceholder: "国家",
              placeholder: "省/市/区(县)",
              propsSelect: {
                value: "countryCode",
                label: "countryName",
                keyAdd: "countryAdd",
              },
              props: {
                value: "areaCode",
                label: "areaName",
                children: "children",
              },
              onCascaderChange: (argeObj, row) => {
                row.provinceCode = argeObj.provinceCode || "";
                row.cityCode = argeObj.cityCode || "";
                row.areaCode = argeObj.areaCode || "";
                row.provinceName = argeObj.provinceName || "";
                row.cityName = argeObj.cityName || "";
                row.areaName = argeObj.areaName || "";
              },
            },
            editRender: {},
            slots: { edit: "province_city_area_edit" },
            formatter: ({ row }) => {
              return characterSegmentation(row,["countryName","provinceName","cityName","areaName"])
            },
            width: 300,
          },
          {
            field: "contactName",
            title: "联系人",
            editRender: {},
            slots: { edit: "input_edit" },
          },
          {
            field: "contactPhone",
            title: "联系人电话",
            editRender: {},
            slots: { edit: "input_edit" },
          },
          {
            field: "pcs",
            title: "件数",
            editRender: {},
            slots: { edit: "input_edit" },
            params: {
              type: "number",
            },
          },
        ],
        multipleSelection: [],
        buttonType: ["add", "delete"],
        batchDelete: true,
        keepSource: true,
        changeEditNeedTrigger: false,
        keepSourceKey: "address",
        tableId: "trunkLineDetails",
        onDelete: (black) => {
          onDeleteDetails(black);
        },
      },
      {
        title: "保险信息",
        formLayout: "el-row",
        content: [
          {
            label: "是否保险",
            prop: "insuranceType",
            type: "label_radio",
            options: [
              {
                label: "无保险",
                value: 0,
              },
              {
                label: "客户",
                value: 1,
              },
              {
                label: "公司",
                value: 2,
              },
              {
                label: "自购",
                value: 3,
              },
            ],
            span: 24,
          },
          {
            label: "货值",
            prop: "insuranceGoodsValue",
            selectProp: "insuranceCurrency",
            type: "label_input_select",
            options: [],
            props: {
              label: "subName",
              value: "subName",
            },
          },
          {
            label: "免赔率/费率",
            prop: "deductibleRate",
            type: "label_multiple_number",
            options: [
              {
                prop: "insuranceDeductibleRate",
                precision: 2,
                remoteSpan: 12,
              },
              {
                prop: "insuranceRate",
                precision: 2,
                remoteSpan: 12,
              },
            ],
          },
          {
            label: "保费",
            prop: "insurancePremium",
            type: "label_number",
          },
          {
            label: "保险备注",
            prop: "insuranceRemark",
            type: "label_input",
            rows: 1,
            inputType: "textarea",
          },
          {
            label: "受益公司",
            prop: "beneficialCompany",
            type: "label_input",
          },
          {
            label: "受益税号",
            prop: "beneficialTaxNo",
            type: "label_input",
          },
          {
            label: "受益地址",
            prop: "beneficialAddress",
            type: "label_input",
            rows: 1,
            inputType: "textarea",
          },
        ],
      },
      {
        title: "船期信息",
        formLayout: "el-row",
        content: [
          {
            label: "船司",
            prop: "providerName",
          },
          {
            label: "起运港",
            options: [
              {
                value: "loadingPortCode",
              },
              {
                value: "loadingPortName",
              },
            ],
          },
          {
            label: "卸货港",
            options: [
              {
                value: "dischargePortCode",
              },
              {
                value: "dischargePortName",
              },
            ],
          },
          {
            label: "目的港",
            options: [
              {
                value: "deliveryPortCode",
              },
              {
                value: "deliveryPortName",
              },
            ],
          },
          {
            label: "船名/航次",
            options: [
              {
                value: "vesselName",
              },
              {
                value: "voyageNo",
              },
            ],
          },
          {
            label: "ETD/ATD",
            options: [
              {
                value: "estimatedTimeDeparture",
              },
              {
                value: "actualTimeDeparture",
              },
            ],
          },
          {
            label: "ETA/ATA",
            options: [
              {
                value: "estimatedTimeArrivalDischarge",
              },
              {
                value: "actualTimeArrivalDischarge",
              },
            ],
          },
          {
            label: "ETA/ATA",
            options: [
              {
                value: "estimatedTimeArrivalDelivery",
              },
              {
                value: "actualTimeArrivalDelivery",
              },
            ],
          },
        ],
      },
    ],
  },
]);
const rules = ref({});
const saveBtnLoading = ref(false);
const pickupAddressVisible = ref(false);
onMounted(() => {
  onGetSub();
  if (router.query.id) {
    getInfo();
  }
});
watch(
  () => formData.value.insuranceType,
  (val) => {
    if ([1, 2].includes(val)) {
      columnFilters(formColumns.value, "insuranceGoodsValue").hide = false;
      columnFilters(formColumns.value, "deductibleRate").hide = false;
      columnFilters(formColumns.value, "insurancePremium").hide = false;
      columnFilters(formColumns.value, "insuranceRemark").hide = false;
      columnFilters(formColumns.value, "beneficialCompany").hide = false;
      columnFilters(formColumns.value, "beneficialTaxNo").hide = false;
      columnFilters(formColumns.value, "beneficialAddress").hide = false;
    } else {
      columnFilters(formColumns.value, "insuranceGoodsValue").hide = true;
      columnFilters(formColumns.value, "deductibleRate").hide = true;
      columnFilters(formColumns.value, "insurancePremium").hide = true;
      columnFilters(formColumns.value, "insuranceRemark").hide = true;
      columnFilters(formColumns.value, "beneficialCompany").hide = true;
      columnFilters(formColumns.value, "beneficialTaxNo").hide = true;
      columnFilters(formColumns.value, "beneficialAddress").hide = true;
    }
  }
);
watch(
  () => formData.value.receiveGoodsType,
  (val) => {
    if (val) {
      columnFilters(formColumns.value, "pickupAddressList").hide = false;
    } else {
      columnFilters(formColumns.value, "pickupAddressList").hide = true;
    }
  }
);
const getInfo = () => {
  saveBtnLoading.value = true;
  api.default.order.maritimeAdministration
    .getInfo(router.query.id)
    .then((res) => {
      formData.value = {
        ...res.data.oceanOrderExtend,
        ...res.data,

        provinceCityArea: [
          res.data.destWarehouseProvinceCode,
          res.data.destWarehouseCityCode,
          res.data.destWarehouseAreaCode,
        ],
        labelingTypeCode: res.data.labelingTypeCode?.split(","),
        pickupAddressList: res.data.oceanOrderPickupAddress || [],
      };
      productQueryList();
      customerGetInfo(formData.value.customerCode);
    })
    .finally(() => {
      saveBtnLoading.value = false;
    });
};
const onGetSub = () => {
  getSubZhEn({
    code: "020,025,026,027,003",
  }).then((res) => {
    columnFilters(formColumns.value, "orderTypeCode").options = res["020"];
    columnFilters(formColumns.value, "customsDeclareTypeCode").options =
      res["025"];
    columnFilters(formColumns.value, "customsClearanceTypeCode").options =
      res["026"];
    columnFilters(formColumns.value, "labelingTypeCode").options = res["027"];
    columnFilters(formColumns.value, "insuranceGoodsValue").options =
      res["003"];
  });
};
const customerGetInfo = (val) => {
  api.default.common.customers
    .getInfoByCode({
      code: val,
    })
    .then((res) => {
      columnFilters(formColumns.value, "noPrefix").options = res.data?.noPrefix
        ? res.data.noPrefix.split(",").map((item) => {
            return {
              label: item,
              value: item,
            };
          })
        : [];
      formData.value.customerServiceCode =
        res.data.oceanCustomerServiceList?.[0].employeeCode;
      formData.value.customerServiceName =
        res.data.oceanCustomerServiceList?.[0].employeeName;
      formData.value.bindEmployeeList = res.data?.oceanEmployeesList?.map(
        (item) => {
          return {
            empCode: item.employeeCode,
            empName: item.employeeName,
            divideRatio: item.divideRatio,
          };
        }
      );
      const sendList =
        res.data.coopList.filter(
          (item) => item.coopCustomerTypeCode === "019001"
        ) || [];
      const harvestList =
        res.data.coopList.filter(
          (item) => item.coopCustomerTypeCode === "019002"
        ) || [];
      const throughList =
        res.data.coopList.filter(
          (item) => item.coopCustomerTypeCode === "019003"
        ) || [];
      columnFilters(formColumns.value, "shipperInfo").options = sendList;
      columnFilters(formColumns.value, "consigneeInfo").options = harvestList;
      columnFilters(formColumns.value, "notifierInfo").options = throughList;
    });
};
const productQueryList = () => {
  api.default.common.product
    .queryList({
      id: formData.value.subProductId,
    })
    .then((res) => {
      const data = res.data?.[0];
      goodsTypeArr(data);
    });
};
const goodsTypeArr = (data) => {
  const arr = data?.goodsTypeCode
    ? data?.goodsTypeCode.split(",").map((item, index) => {
        return {
          subCode: item,
          subName: data.goodsTypeName.split(",")[index],
        };
      })
    : [];
  columnFilters(formColumns.value, "goodsTypeCode").options = arr;
};
const onSubmit = () => {
  const params = {
    ...formData.value,
    labelingTypeCode: formData.value.labelingTypeCode?.join(","),
  };
  saveBtnLoading.value = true;
  if (!router.query?.id) {
    api.default.order.maritimeAdministration
      .add(params)
      .then((res) => {
        ElMessage.success(i18n.global.t("新增成功"));
        saveBtnLoading.value = false;
      })
      .catch(() => {
        saveBtnLoading.value = false;
      });
  } else {
    api.default.order.maritimeAdministration
      .edit(params)
      .then((res) => {
        ElMessage.success(i18n.global.t("修改成功"));
        saveBtnLoading.value = false;
      })
      .catch(() => {
        saveBtnLoading.value = false;
      });
  }
};
const onPickupAddress = (val) => {
  formData.value.pickUpAddress = val;
};
</script>

<style scoped lang="scss">
.entrust {
  height: 100%;
}
</style>